package com.znufe.exam.viewmodel.admin.category;

import com.znufe.exam.domain.Category;
import com.znufe.exam.utility.DateTimeUtil;
import com.znufe.exam.viewmodel.BaseVM;
import lombok.Data;


@Data
public class CategoryResponseVM extends BaseVM {

    private Integer id;

    private String concreteName;

    private String createTime;

    private Integer isEnabled;

    public static CategoryResponseVM from(Category category) {
        CategoryResponseVM vm = modelMapper.map(category, CategoryResponseVM.class);
        vm.setCreateTime(DateTimeUtil.dateFormat(category.getCreateTime()));
        return vm;
    }

}
